package com.example.coco.Controller;


import com.example.coco.model.Suggestion;
import com.example.coco.res.SuggestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ShowSug {

    @Autowired
    SuggestionMapper suggestionMapper;

    @GetMapping("/sug")
    public String showSuggestion(ModelMap map) {
        List<Suggestion> suggestions = suggestionMapper.showsug();
        map.addAttribute("suggestions", suggestions);
        return "Show";
    }
}
//@Controller
//public class ShowSug {
//    @Autowired
//    SuggestionMapper suggestionMapper;
//    @RequestMapping("/sugShow")
//    public String selectSug(ModelMap map){
//        List<Suggestion> suggestionList = suggestionMapper.showsug();
//        map.addAllAttributes("suggestionShow", suggestionList);
//        return "suggestionShow";
//    }
//
//}
